Skip to content

Conversation

Ben2W
Copy link
Contributor

@Ben2W Ben2W commented Sep 30, 2025

Our oauth applications feature has a /oauth/end_session endpoint.

In order for this endpoint to work, we need to know about the clerk client. In development we need to grab the dev browser (even if logged out).

Summary by CodeRabbit

  • Bug Fixes

    • Improved OAuth/OIDC logout handling by recognizing /oauth/end_session as a valid redirect for FAPI-initiated flows, ensuring seamless return without extra prompts.
  • Chores

    • Bumped @clerk/clerk-js to a new minor version to include the updated redirect handling.

Copy link

changeset-bot bot commented Sep 30, 2025

🦋 Changeset detected

Latest commit: 7fff6e3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@clerk/clerk-js Minor
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Sep 30, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
clerk-js-sandbox Ready Ready Preview Comment Oct 3, 2025 4:49pm

Copy link
Contributor

coderabbitai bot commented Sep 30, 2025

Walkthrough

Added OIDC logout path (/oauth/end_session) to the set of frontend API redirect paths treated as FAPI-initiated flows without user input. Updated corresponding utility logic and tests to recognize this path. Added a changeset noting a minor version bump.

Changes

Cohort / File(s) Summary
FAPI redirect paths update (logic)
packages/clerk-js/src/utils/url.ts
Include /oauth/end_session in frontendApiRedirectPathsNoUserInput; isRedirectForFAPIInitiatedFlow now recognizes this path.
Unit tests
packages/clerk-js/src/utils/__tests__/url.test.ts
Added assertions for /oauth/end_session in FAPI redirect detection and requiresUserInput (expect false).
Changeset/metadata
.changeset/gold-geckos-fix.md
Minor version bump entry; documents added path to no-user-input redirects.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant B as Browser
  participant U as Clerk JS Utils
  participant FA as Frontend API

  Note over B,U: Redirect handling on return from OAuth/OIDC flow
  B->>U: Provide redirect URL (/oauth/end_session)
  U->>U: Check against no-user-input paths
  alt Path matches
    U-->>B: isRedirectForFAPIInitiatedFlow = true<br/>requiresUserInput = false
    B->>FA: Continue logout completion (end_session)
    FA-->>B: Confirmation/next step
  else Path does not match
    U-->>B: Regular handling (may require user input)
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I hop through routes with nimble grace,
Found “end_session” in the place,
No extra clicks, no forms to send—
A tidy bow on OIDC’s end.
With tests that chirp, “All paths align,”
I thump my foot: release time! 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly and succinctly describes the primary change—adding the OIDC logout path to the frontendApiRedirectPathsNoUserInput list in the clerk-js package—which directly aligns with the diff and PR objectives.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ben/adding-oidc-logout-toredirect-list

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 736bb8e and 7fff6e3.

📒 Files selected for processing (1)
  • packages/clerk-js/src/utils/__tests__/url.test.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (9)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

**/*.{js,jsx,ts,tsx}: All code must pass ESLint checks with the project's configuration
Follow established naming conventions (PascalCase for components, camelCase for variables)
Maintain comprehensive JSDoc comments for public APIs
Use dynamic imports for optional features
All public APIs must be documented with JSDoc
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Profile and optimize critical paths
Validate all inputs and sanitize outputs
Implement proper logging with different levels

Files:

  • packages/clerk-js/src/utils/__tests__/url.test.ts
**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use Prettier for consistent code formatting

Files:

  • packages/clerk-js/src/utils/__tests__/url.test.ts
packages/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

TypeScript is required for all packages

Files:

  • packages/clerk-js/src/utils/__tests__/url.test.ts
packages/**/*.{ts,tsx,d.ts}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Packages should export TypeScript types alongside runtime code

Files:

  • packages/clerk-js/src/utils/__tests__/url.test.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use proper TypeScript error types

**/*.{ts,tsx}: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoid any type - prefer unknown when type is uncertain, then narrow with type guards
Use interface for object shapes that might be extended
Use type for unions, primitives, and computed types
Prefer readonly properties for immutable data structures
Use private for internal implementation details
Use protected for inheritance hierarchies
Use public explicitly for clarity in public APIs
Prefer readonly for properties that shouldn't change after construction
Prefer composition and interfaces over deep inheritance chains
Use mixins for shared behavior across unrelated classes
Implement dependency injection for loose coupling
Let TypeScript infer when types are obvious
Use const assertions for literal types: as const
Use satisfies operator for type checking without widening
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Use type-only imports: import type { ... } from ...
No any types without justification
Proper error handling with typed errors
Consistent use of readonly for immutable data
Proper generic constraints
No unused type parameters
Proper use of utility types instead of manual type construction
Type-only imports where possible
Proper tree-shaking friendly exports
No circular dependencies
Efficient type computations (avoid deep recursion)

Files:

  • packages/clerk-js/src/utils/__tests__/url.test.ts
packages/**/*.{test,spec}.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Unit tests should use Jest or Vitest as the test runner.

Files:

  • packages/clerk-js/src/utils/__tests__/url.test.ts
packages/{clerk-js,elements,themes}/**/*.{test,spec}.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Visual regression testing should be performed for UI components.

Files:

  • packages/clerk-js/src/utils/__tests__/url.test.ts
**/*.{js,ts,tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Support multiple Clerk environment variables (CLERK_, NEXT_PUBLIC_CLERK_, etc.) for configuration.

Files:

  • packages/clerk-js/src/utils/__tests__/url.test.ts
**/__tests__/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/typescript.mdc)

**/__tests__/**/*.{ts,tsx}: Create type-safe test builders/factories
Use branded types for test isolation
Implement proper mock types that match interfaces

Files:

  • packages/clerk-js/src/utils/__tests__/url.test.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Build Packages
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: semgrep/ci
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (2)
packages/clerk-js/src/utils/__tests__/url.test.ts (2)

502-502: LGTM! Test case correctly validates OIDC logout as FAPI-initiated flow.

The test case correctly validates that /oauth/end_session is recognized as a FAPI-initiated flow, aligning with the PR objective to support OIDC logout endpoints.


523-523: LGTM! Test case correctly validates that OIDC logout doesn't require user input.

The test case correctly validates that /oauth/end_session does not require user input, which aligns with the PR objective to enable dev browser acquisition even when the user is logged out.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

pkg-pr-new bot commented Sep 30, 2025

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@6890

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@6890

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@6890

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@6890

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@6890

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@6890

@clerk/elements

npm i https://pkg.pr.new/@clerk/elements@6890

@clerk/clerk-expo

npm i https://pkg.pr.new/@clerk/clerk-expo@6890

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@6890

@clerk/express

npm i https://pkg.pr.new/@clerk/express@6890

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@6890

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@6890

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@6890

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@6890

@clerk/clerk-react

npm i https://pkg.pr.new/@clerk/clerk-react@6890

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@6890

@clerk/remix

npm i https://pkg.pr.new/@clerk/remix@6890

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@6890

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@6890

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@6890

@clerk/themes

npm i https://pkg.pr.new/@clerk/themes@6890

@clerk/types

npm i https://pkg.pr.new/@clerk/types@6890

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@6890

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@6890

commit: 7fff6e3

@Ben2W Ben2W changed the title adding oidc logout to frontendApiRedirectPathsNoUserInput feat(clerk-js): Adding oidc logout to frontendApiRedirectPathsNoUserInput Sep 30, 2025
@Ben2W Ben2W merged commit 3f56b42 into main Oct 3, 2025
43 checks passed
@Ben2W Ben2W deleted the ben/adding-oidc-logout-toredirect-list branch October 3, 2025 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants